﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Zhaoxi.HeatExchange.Controls
{
    /// <summary>
    /// DataBoard.xaml 的交互逻辑
    /// </summary>
    public partial class DataBoard : UserControl
    {
        public ObservableCollection<ItemModel> ItemsSource
        {
            get
            {
                return (ObservableCollection<ItemModel>)GetValue(ItemsSourceProperty);
            }
            set
            {
                SetValue(ItemsSourceProperty, value);
            }
        }
        public static readonly DependencyProperty ItemsSourceProperty =
            DependencyProperty.Register("ItemsSource", typeof(ObservableCollection<ItemModel>), typeof(DataBoard), new PropertyMetadata(null));


        public DataBoard()
        {
            InitializeComponent();
        }
    }

    public class ItemModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;

        public string Name { get; set; }
        private double _value;

        public double Value
        {
            get { return _value; }
            set
            {
                _value = value;

                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Value"));
            }
        }

        public string Unit { get; set; }
    }
}
